#define _CRT_SECURE_NO_WARNINGS
#pragma once
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>

typedef int HeapDataType;
typedef struct Heap
{
	HeapDataType* arr;
	int size;
	int capacity;
}Heap;

void HeapInit(Heap* pp);

void HeapPrint(Heap* pp);

void HeapDestory(Heap* pp);

void HeapPush(Heap* pp, HeapDataType val);

void HeapSwap(HeapDataType* p1, HeapDataType* p2);

void AdjustUp(HeapDataType* pp, int child);

void AdjustDown(HeapDataType* pp, int n, int parent);

void HeapCheckCapacity(Heap* pp);

void HeapPop(Heap* pp);

HeapDataType HeapTop(Heap* pp);

bool HeapEmpty(Heap* pp);

int HeapSize(Heap* pp);

void HeapCreate(Heap* pp, HeapDataType* arr, int n);